package csce315.group10.androidapp;

import java.util.ArrayList;

import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;

import android.os.Parcel;
import android.os.Parcelable;


@Root
public class TopicCatalog{
	@ElementList(name = "topics",required = false)
	ArrayList<Topic> topics;
	
	public TopicCatalog(){
		topics = new ArrayList<Topic>();
	}
	/* constructor used by Parcelable */
	public TopicCatalog(Parcel source){
        /*
         * Reconstruct from the Parcel
         */
        source.readTypedList(topics,Topic.CREATOR);

  }
	/* used in serialization to pass in an intent */
	public int describeContents() {
		return hashCode();
	}
	/* used to serialize data to pass in an intent*/
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeTypedList(topics);
	}
	/* used to create an event object from Parcelable */
	public static final Parcelable.Creator CREATOR =
    	new Parcelable.Creator() {
            public TopicCatalog createFromParcel(Parcel in) {
                return new TopicCatalog(in);
            }
 
            public TopicCatalog[] newArray(int size) {
                return new TopicCatalog[size];
            }
        };
	public ArrayList<Topic> getTopics(){
		return topics;
	}
	
	public void setTopics(ArrayList<Topic> _topics){
		topics = _topics;
	}
}